package com.hncj.android.zxing

import android.Manifest
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.FragmentActivity
import com.hncj.android.zxing.databinding.ActivityMainBinding
import com.permissionx.guolindev.PermissionX

class MainActivity: FragmentActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.testButton.setOnClickListener {
            PermissionX.init(this)
                .permissions(Manifest.permission.CAMERA)
                .request { allGranted, grantedList, deniedList ->
                    if(allGranted){
                        startActivity(Intent(this, TestQRCodeActivity::class.java))
                    }
                }

        }

    }
}